import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'
import Phone from '../views/Phone.vue'
import Cart from '../views/Cart.vue'
import Layout from '../components/Layout.vue'

Vue.use(VueRouter)

const routes = [
  {path:'/',redirect:'/home/index'},
  {
    path: '/home',
    name: 'Home',
    component: Layout,
    redirect:'/home/index',
    children:[
      {path: '/home/index',name: 'Index',component: Index},
      {path: '/home/phone',name: 'Phone',component: Phone},
      {path: '/home/cart',name: 'Cart',component: Cart},
    ]
  },
  {path:'/*',redirect:'/home/index'},
]

const router = new VueRouter({
  routes
})

export default router
